<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<sec:authentication property="principal" var="currentPrincipal" scope="page" />

<div id="anchor-supplier-staff" class="block-heading">
  <h5>关键岗位信息（所有<span class="color-red">*</span>项必填）</h5>
</div>

<table class="table table-hover ms-table ">
  <thead>
    <tr>
      <th style="width: 20%;">岗位\详细信息</th>
      <th>姓名</th>
      <th>电话</th>
      <th>手机</th>
      <th>Email</th>
      <th>QQ</th>
      <c:if test="${supplierMenuType != 'sub'}">
        <th>操作</th>
      </c:if>
    </tr>
  </thead>

  <tbody>
    <c:forEach items="${enums['KeyPost'] }" var="keyPost">
      <c:set var="display" value="false" />
      <tr>
      
        <c:if test="${(keyPost.alias eq supplier.type.code) or (keyPost.alias eq '0')}">

          <c:choose>
            <c:when test="${supplier.type.commonStorage}">

              <c:if test="${keyPost.canCommonStorageSupplierShow()}">
                <td>${keyPost.description }</td>

                <c:forEach items="${supplierStaffs}" var="supplierStaff">
                  <c:if test="${keyPost.description eq supplierStaff.keyPost.description}">
                    <td>${empty supplierStaff.name ? '无' : supplierStaff.name}</td>
                    <td>${empty supplierStaff.telephone ? '无' : supplierStaff.telephone}</td>
                    <td>${empty supplierStaff.mobile ? '无' : supplierStaff.mobile}</td>
                    <td>${empty supplierStaff.email ? '无' : supplierStaff.email}</td>
                    <td>${empty supplierStaff.tencent ? '无' : supplierStaff.tencent}</td>
                    <c:if test="${supplierMenuType != 'sub'}">
                      <td><a href="${ctx.host}/suppliers/${supplier.id}/supplier-staff/${supplierStaff.id}/edit" data-target="#edit" data-toggle="modal">修改</a>&nbsp;&nbsp;</td>
                    </c:if>
                    <c:set var="display" value="true" />
                  </c:if>
                </c:forEach>

                <c:if test="${not display}">
                  <td>无</td>
                  <td>无</td>
                  <td>无</td>
                  <td>无</td>
                  <td>无</td>
                  <c:if test="${supplierMenuType != 'sub'}">
                    <td><a href="${ctx.host}/suppliers/${supplier.id}/supplier-staff/create?keyPost=${keyPost.code}" data-target="#edit" data-toggle="modal">新建</a>&nbsp;&nbsp;</td>
                  </c:if>
                </c:if>
              </c:if>

            </c:when>

            <c:otherwise>
              <td>${keyPost.description }</td>

              <c:forEach items="${supplierStaffs}" var="supplierStaff">
                <c:if test="${keyPost.description eq supplierStaff.keyPost.description}">
                  <td>${empty supplierStaff.name ? '无' : supplierStaff.name}</td>
                  <td>${empty supplierStaff.telephone ? '无' : supplierStaff.telephone}</td>
                  <td>${empty supplierStaff.mobile ? '无' : supplierStaff.mobile}</td>
                  <td>${empty supplierStaff.email ? '无' : supplierStaff.email}</td>
                  <td>${empty supplierStaff.tencent ? '无' : supplierStaff.tencent}</td>
                  <c:if test="${supplierMenuType != 'sub'}">
                    <td><a href="${ctx.host}/suppliers/${supplier.id}/supplier-staff/${supplierStaff.id}/edit" data-target="#edit" data-toggle="modal">修改</a>&nbsp;&nbsp;</td>
                  </c:if>
                  <c:set var="display" value="true" />
                </c:if>
              </c:forEach>

              <c:if test="${not display}">
                <td>无</td>
                <td>无</td>
                <td>无</td>
                <td>无</td>
                <td>无</td>
                <c:if test="${supplierMenuType != 'sub'}">
                  <td><a href="${ctx.host}/suppliers/${supplier.id}/supplier-staff/create?keyPost=${keyPost.code}" data-target="#edit" data-toggle="modal">新建</a>&nbsp;&nbsp;</td>
                </c:if>
              </c:if>
            </c:otherwise>

          </c:choose>

        </c:if>

      </tr>
    </c:forEach>
  </tbody>
</table>